package com.xinqi.modules.course.clazz.mapper;

import com.xinqi.common.mybatis.data.repo.SuperMapper;
import com.xinqi.modules.course.clazz.domain.ClassEntity;
import com.xinqi.modules.course.clazz.dto.req.ClassQueryDTO;
import com.xinqi.modules.course.clazz.dto.rsp.ClassAppResultDTO;
import com.xinqi.modules.course.clazz.dto.rsp.ClassResultDTO;
import com.xinqi.modules.course.clazz.dto.rsp.ClassTeacherResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 班级表数据层
 *
 * @author: system
 * @date: 2023/01/17
 */
@Mapper
public interface ClassMapper extends SuperMapper<ClassEntity> {
    List<ClassResultDTO> findByCourseIdAndIsTeacher(@Param("courseId") Long courseId, @Param("classId") Long classId, @Param("studentId") Long studentId, @Param("isTeacher") Integer isTeacher, @Param("isArchive") Integer isArchive);

    ClassResultDTO findByCode(@Param("code") String code);

    ClassResultDTO findDetail(@Param("query") ClassQueryDTO query);

    ClassResultDTO findByClassId(@Param("classId") Long classId);

    ClassAppResultDTO findClassInfoByCode(@Param("code") String code);

    ClassTeacherResultDTO findTeacherInfoByClassId(Long id);

    List<ClassResultDTO> findByCourseIdAndRoles(@Param("courseId") Long courseId, @Param("classId") Long classId, @Param("studentId") Long studentId, @Param("classRoles") List<String> classRoles, @Param("isArchive") Integer isArchive);

    Integer findAddedClassCountByUserId(@Param("userId") Long userId);

    List<ClassResultDTO> findArchivedClassAndRoleByCourseIdAndStudentId(@Param("courseId") Long courseId, @Param("userId") Long userId, @Param("isArchive") Integer isArchive);

    List<ClassResultDTO> findListByCourseIdAndNotEqCurrentClassIdAndClassRoleIsTeacher(@Param("courseId") Long courseId, @Param("classId") Long classId, @Param("studentId") Long studentId, @Param("isTeacher") Integer isTeacher);
}
